package home.my.recordmanage.util;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;

public class MyUtil {
	private static Map<String, String> rpMap;
	static {
		rpMap = new LinkedHashMap<String, String>();
		rpMap.put("<p", "&lt;p");
		rpMap.put("&lt;br(/)?&gt;", "<br/>");
//		rpMap.put("&lt;br&gt;", "<br/>");
		rpMap.put("\r\n", "<br/>");
		rpMap.put("\n", "<br/>");
		rpMap.put("\r", "<br/>");
		rpMap.put("'", "\"");
		rpMap.put("\\'", "\"");
	}

	public static String rpToWeb(String source) {
		if (source == null) {
			return null;
		} else {
			for (Entry<String, String> keyValue : rpMap.entrySet()) {
				source = source.replaceAll(keyValue.getKey(), keyValue
						.getValue());
			}
			return source;
		}
	}
}
